package com.itheima.dao;

import com.itheima.domain.Account;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public interface  AccountDao {

   @Update("update account set money=money+#{money} where id=#{id} ")
     void add(@Param("id") int id, @Param("money") double money);


  //利用注解写SQL语句
    @Update("update account set money=money-#{money} where id=#{id}")
    void sub(@Param("id") int id, @Param("money") double money);


    //写SQL语句在xml文件中
     void save(Account account) ;

     void delete(int id) ;

     Account findById(int id) ;
}
